/**
 * 
 */
package com.sb.money.util;

import java.text.MessageFormat;
import java.util.ResourceBundle;

/**
 * Message utility class to read the messages.properties.
 * 
 * @author Stefan Bertos
 * 
 */
public final class MessagesUtil {

    /**
     * Resource bundle loaded.
     */
    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
            .getBundle("messages");

    /**
     * private constructor.
     */
    private MessagesUtil() {
    }

    /**
     * get a message.
     * 
     * @param key
     *            message key
     * @return String message
     */
    public static String message(final String key) {
        return RESOURCE_BUNDLE.getString(key);
    }

    /**
     * get a parameterized message.
     * 
     * @param key
     *            message key
     * @param arguments
     *            message parameters
     * @return String message
     */
    public static String message(final String key, final Object... arguments) {
        return MessageFormat.format(message(key), arguments);
    }
}